<template>
	<view v-show="isShow">
		<u-form class="operation" label-position='top' :label-style="labelStyle">
			<u-form-item label="待检测单号" required>
				<u-input :border="true" v-model="awaitNumbers" placeholder="" type="textarea" :maxlength="1000" />
			</u-form-item>
			<view style="display: flex">
				<view style="width: 50%;">
					<u-button @click="scan" style="margin-bottom: 10rpx;">扫描</u-button>
				</view>
				<view style="width: 50%;">
					<u-button @click="detection" type="success">检测</u-button>
				</view>
			</view>
			<u-form-item label="未通过单号">
				<u-input @click='copy' :border="true" v-model="errorNumbers" placeholder="" type="textarea" :maxlength="1000"
				 :disabled='true' />
			</u-form-item>
		</u-form>

		<u-form :model="form" ref="uForm" class="operation" label-position='top' :label-style="labelStyle">
			<!-- 单号 -->
			<u-form-item label="通过单号" prop='numbers'>
				<u-input :border="true" v-model="form.numbers" placeholder="" type="textarea" :maxlength="1000" :disabled='true' />
			</u-form-item>

			<!-- 物流信息 -->
			<u-form-item label="备注" prop='notes'>
				<u-input :border="true" v-model="form.notes" placeholder="中文" />
			</u-form-item>
			<u-form-item label="备注" prop='laosNotes'>
				<u-input :border="true" v-model="form.laosNotes" placeholder="老挝" />
			</u-form-item>
			<u-form-item label="发往网点" prop='sendToUserId' required>
				<u-input :border="true" v-model="form.sendToName" @click="sendShow = true" type="select" placeholder="" />
				<u-picker @confirm="selectSend" mode="selector" v-model="sendShow" title="发往网点" :mask-close-able="true" :range="sendSite"
				 range-key="name"></u-picker>
			</u-form-item>
		</u-form>

		<!-- 提交 -->
		<view class="submitBtn">
			<u-button @click='submit' type="warning" throttleTime="500" hoverStayTime="100" :custom-style="submitBtnStyle" shape="circle"
			 :ripple="true">添加</u-button>
		</view>
		<u-toast ref="uToast" />
	</view>
</template>

<script>
	import JS from '../JS.js'

	export default {
		name: 'Emit',
		mixins: [JS],
		data() {
			return {
				state: 1 // 0揽收 1发出 2到达 3待取件 4问题件 5签收
			}
		},
		methods: {
			init() {
				this.getAllSite()
				this.$refs.uForm.setRules(this.rules);
				this.isShow = true;
			},

			// 关闭
			cancel() {
				let errorNumbers = this.errorNumbers
				resetForm(this).then(() => {
					this.errorNumbers = errorNumbers
					this.getAllSite()
				})
			}
		}
	}
</script>

<style lang="scss">
	.operation {
		padding-left: 16rpx;
		padding-right: 8rpx;
		background-color: #FFFFFF;
		border-top: rgb(230, 230, 230) solid 2rpx;
	}

	.submitBtn {
		height: 110rpx;
		flex-direction: column;
		z-index: 101;
		background: #FFFFFF;
		padding: 10px;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.copy {
		text-align: right;
		color: #6767d8;
		margin-top: 5rpx;
	}
</style>
